package com.momo.todo.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/10/29.
 */

public class MyDatabaseHelper extends SQLiteOpenHelper {
    private Context context;

    public static final String CREATE_PLAN_TABLE = "create table if not exists plans ("
            +"id integer primary key autoincrement, "
            +"type integer, "
            +"time long, "
            +"isTop integer, "
            +"content text) ";


    public static final String CREATE_HISTORY_TABLE = "create table if not exists histories ("
            +"id integer primary key autoincrement, "
            +"type integer, "
            +"time long, "
            +"content text, "
            +"finishTime long) ";

    public MyDatabaseHelper(Context context,String databaseName){
        super(context, databaseName,null,1);
        this.context = context;
    }

    public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_PLAN_TABLE);
        db.execSQL(CREATE_HISTORY_TABLE);
        LogUtils.log("创建成功！");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
